' ****** START INCLUDE UrlKey$(key$) ****** FUNCTION UrlKey$(key$) UrlKey$ = "" keyPos% = INSTR( UCASE$(UrlQueryString$), [ UCASE$(key$) + "=" ] ) IF keyPos% THEN step1$ = RIGHT$( UrlQueryString$, [ LEN(UrlQueryString$) - keyPos% - LEN(key$) ] ) step2% = INSTR(step1$, "&") UrlKey$ = IFF( step2%, [ LEFT$(step1$, step2% - 1 ) ], step1$) END IF END FUNCTION ' ****** END INCLUDE UrlKey$(key$) ******_TITLE "Fractals in Focus" ' This program exported from BASIC Anywhere Machine (Version [5.2.3].[2024.09.09.00.00]) on 2025.01.19 at 01:44 (Coordinated Universal Time) ' This program by Charlie Veniot is a port and mod ' of Steve Justice's program presented in the "Fractals in Focus" ' article (page 58) in the May 1985 issue of 80micro magazine ' https://archive.org/details/80-microcomputing-magazine-1985-05/page/n59/mode/1up autoPilot$ = UrlKey$(autoPilot) 10 REM FRACTALS FOR THE MODEL 3/4 1-HTH HIGH RESOLUTION 12 REM 15 REM SCREEN PIXEL SIZES 20 SCREEN _NEWIMAGE( 680, 220, 15 ) DIM LCOLOR%( 1 TO 7 ) CF = 3.14159 / 180 : MX = 620 : MY = 240 25 SF = 0.8 27 CLS : w = 0 : x1 = 0 : y1 = 0 : x = 0 : y = 0 : a = 0 : b$ = "" : iCombo% = 0 GOSUB NewColors 30 IF iCombo% = 0 _ THEN PRINT "Number of sides" : PRINT " (min = 3," : PRINT " (max = 20): "; IF autoPilot$ = "Y" AND iCombo% = 0 _ THEN : S = INT( RND * 18 ) + 3 : PRINT S ELSE : IF iCombo% = 0 THEN INPUT ""; S END IF S = MIN( MAX( VAL( S ), 3 ), 20 ) 35 REM BEGINNING X AND Y (SCALED TO SCREEN SIZE 40 CX = MX * 0.7 : CY = MY * 0.8 : X2 = CX : Y2 = MY + 1 - CY 60 IF iCombo% = 0 _ THEN PRINT "Inverse image" : PRINT " (Y = yes," : PRINT " C = both): "; IF autoPilot$ = "Y" AND iCombo% = 0 _ THEN : I$ = MID$( "YNC", INT( RND * 3 ) + 1, 1 ) : PRINT I$ ELSE : IF iCombo% = 0 THEN INPUT ""; I$ : I$ = UCASE$( LEFT$( I$ , 1 ) ) END IF 70 REM ANGLES TO TURN RIGHT AND LEFT 80 R = -360 / S : L = R + 180 90 IF I$ = "Y" THEN C$ = "A" : W = R : R = -L : L = -W ELSE C$ = "R" 100 A$ = C$ 110 IF I$ <> "Y" THEN 140 120 A1$ = "R" : S1 = S - 2 : FOR N = 1 TO S1 : A1$ = A1$ + "L" : NEXT N : A1$ = A1$ + "R" 130 GOTO 160 140 A1$ = "L" : S1 = S - 2 : FOR N = 1 TO S1 : A1$ = A1$ + "R" : NEXT N 150 A1$ = A1$ + "L" 160 IF iCombo% = 0 _ THEN PRINT "Number of levels" : PRINT " (min = 1," : PRINT " max = 6): "; IF autoPilot$ = "Y" AND iCombo% = 0 _ THEN : LE = INT( RND * IFF( S < 10, 5, 2 ) ) + 2 : PRINT LE ELSE : IF iCombo% = 0 THEN INPUT ""; LE END IF IF LE = 1 THEN 230 LE = MAX(MIN( 6, VAL( LE ) ),1) 170 REM EXPAND STRING FOR MULTIPLE LEVELS 190 FOR N = 2 TO LE : LN = LEN( A$ ) 200 FOR N1 = 1 TO LN : B$ = B$ + MID$( A$, N1, 1 ) + A1$ : NEXT N1 210 A$ = B$ : B$ = "" : NEXT N 230 REM SCALE SIZE OF DIAGRAM TO FIT ON SCREEN 240 LL = MX * 1.25 / ( S * 3 ^ LE ) 250 REM CLEAR GRAPHICS SCREEN AND SET TO STARTING X,Y 260 PSET (X2,Y2) ' : SCREEN 0 265 REM START DRAWING FIGURE 270 FOR Z = 1 TO S 280 FOR N = 1 TO LEN( A$ ) 290 B1$ = MID$( A$, N, 1 ) + A1$ 300 FOR N1 = 1 TO LEN( B1$ ) : B$ = MID$( B1$, N1, 1) 310 IF B$ = "A" THEN A = A + W : GOTO 330 320 IF B$ = "L" THEN A = A + L ELSE A = A + R 330 A1 = A * CF 340 X = X + LL * COS( A1 ) : Y = Y + LL * SIN( A1 ) * SF 350 XP = INT( X ) : YP = INT( Y ) : X1 = XP + CX : Y1 = 241 - ( YP / 2 + CY ) : LINE ( X2, Y2 ) - ( X1, Y1 ), LCOLOR%( N1 ) 360 X2 = X1 : Y2 = Y1 370 NEXT N1 : NEXT N : SLEEP 0.001 : NEXT Z 380 REM END OF FIGURE KEYCLEAR IF I$ = "C" AND iCombo% = 0 _ THEN : w = 0 : x1 = 0 : y1 = 0 : x = 0 : y = 0 : a = 0 : b$ = "" iCombo% = 1 I$ = "Y" GOTO 30 ELSE : IF autoPilot$ = "Y" _ THEN : PRINT : PRINT PRINT "Click/touch" PRINT "the screen" PRINT "and hold that" PRINT "click/touch" PRINT "to pause the" PRINT "program." SLEEP 7 WHILE _MOUSEBUTTON : WEND ELSE : PRINT : PRINT PRINT "Click/touch" PRINT "the screen" PRINT "to create a" PRINT "new image." WHILE NOT _MOUSEBUTTON : WEND IF _MOUSEBUTTON THEN WHILE _MOUSEBUTTON : WEND KEYCLEAR END IF GOTO 27 END IF END '🟠🟠🟠GOSUB routine NewColors: multiColor% = INT( RND * 2 ) - 1 oneColor% = INT( RND * 62 ) + 1 FOR I = 1 TO 7 LCOLOR%( I ) = IFF( multiColor%, INT( RND * 63 ) + 1, oneColor% ) NEXT I RETURN